//
//  AttendanceView.m
//  ZYShang
//
//  Created by wangguangming on 15/7/31.
//  Copyright © 2015年 Amber. All rights reserved.
//

#import "AttendanceView.h"

@implementation AttendanceView
#define WIDTH self.frame.size.width
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
        {
        
        [self addall];
        }
    return self;
}
-(void)addall
{
    self.photoImage=[[UIImageView alloc] initWithFrame:CGRectMake(5, 5, WIDTH-10,  WIDTH-10)];
    self.photoImage.contentMode= UIViewContentModeScaleAspectFit;
    self.photoImage.backgroundColor=[UIColor grayColor];
    self.nameLaner=[[UILabel alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.photoImage.frame), WIDTH/2, 30)];
    
    self.idLaber=[[UILabel alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.nameLaner.frame), WIDTH/2, 30)];
    [self.idLaber setAdjustsFontSizeToFitWidth:YES];
    self.phoneLaber=[[UILabel alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.idLaber.frame), WIDTH-10, 30)];
    [self.phoneLaber setAdjustsFontSizeToFitWidth:YES];
    self.offButton=[[UIButton alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.phoneLaber.frame), WIDTH-10, 30)];
    self.offButton.layer.cornerRadius=4;
    
    self.typeLaber=[[UILabel alloc] initWithFrame:CGRectMake(WIDTH-65, CGRectGetMaxY(self.photoImage.frame)+5, 60, 60)];
    self.typeLaber.layer.cornerRadius=30;
    self.typeLaber.layer.borderColor=[[UIColor redColor] CGColor];
    self.typeLaber.textColor=[UIColor redColor];
    self.typeLaber.textAlignment=NSTextAlignmentCenter;
    self.typeLaber.layer.borderWidth=1.0;
    [self.typeLaber setAdjustsFontSizeToFitWidth:YES];
    self.nameLaner.textColor=[UIColor grayColor];
    self.idLaber.textColor=[UIColor grayColor];
    self.phoneLaber.textColor=[UIColor grayColor];
    
    [self addSubview:self.photoImage];
    [self addSubview:self.nameLaner];
    [self addSubview:self.idLaber];
    [self addSubview:self.phoneLaber];
    [self addSubview:self.offButton];
    [self addSubview:self.typeLaber];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
